package com.mrjy.integral.controller;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.mrjy.common.entity.IntegralExchange;
import com.mrjy.integral.bo.IIntegralExchangeBo;
import com.mrjy.integral.dto.IntegralExchangeDTO;

@Controller
@RequestMapping("/integral/integralExchange")
public class IntegralExchangeController {
	
	@Resource
	private IIntegralExchangeBo integralExchangeBo ;
	
	/**
	 * 添加兑换物
	 * @param exchange
	 * @param session
	 * @return
	 */
	@RequestMapping("/insert")
	@ResponseBody
	public Object insert(IntegralExchangeDTO dto,HttpSession session){
		return integralExchangeBo.txInsert(dto,session);
	}
	
	/**
	 * 编辑
	 * @param dto
	 * @param session
	 * @return
	 */
	@RequestMapping("/update")
	@ResponseBody
	public Object update(IntegralExchangeDTO dto,HttpSession session){
		return integralExchangeBo.txUpdate(dto,session);
	}
	
	/**
	 * 启用,禁用
	 * @param dto
	 * @param session
	 * @return
	 */
	@RequestMapping("/updateDisableFlag")
	@ResponseBody
	public Object updateDisableFlag(IntegralExchange exchange,HttpSession session){
		return integralExchangeBo.txUpdateDisableFlag(exchange,session);
	}
	
	/**
	 * for weixin
	 * 查询兑换物列表 支持分页
	 * @param exchange
	 * @param session
	 * @return
	 */
	@RequestMapping("/queryPage")
	@ResponseBody
	public Object queryPage(IntegralExchange exchange,HttpSession session){
		return integralExchangeBo.queryPage(exchange,session);
	}
	
	/**
	 * for back
	 * 查询兑换物列表 支持分页
	 * @param exchange
	 * @param session
	 * @return
	 */
	@RequestMapping("/queryPageForBack")
	@ResponseBody
	public Object queryPageForBack(IntegralExchangeDTO dto,HttpSession session){
		return integralExchangeBo.queryPageForBack(dto,session);
	}
	
	/**
	 * 导出excel
	 * @param dto
	 * @param session
	 * @return
	 */
	@RequestMapping("/export")
	@ResponseBody
	public Object export(IntegralExchangeDTO dto,HttpSession session,HttpServletResponse response){
		return integralExchangeBo.export(dto,session,response);
	}
	
	/**
	 * 查询兑换物详情
	 * @param exchange
	 * @param session
	 * @return
	 */
	@RequestMapping("/queryDetailById")
	@ResponseBody
	public Object queryDetailById(IntegralExchange exchange,HttpSession session){
		return integralExchangeBo.queryDetailById(exchange,session);
	}
}
